
export default class Vector3Extension
{


    private static s_up:Laya.Vector3=new Laya.Vector3(0,1,0);
    public static get  Up()
    {
        return Vector3Extension.s_up;
    }

    private static s_down:Laya.Vector3=new Laya.Vector3(0,-1,0);
    public static get  Down()
    {
        return Vector3Extension.s_down;
    }

    public static Subtract(a:Laya.Vector3,b:Laya.Vector3 ):Laya.Vector3
    {
        let result:Laya.Vector3=new Laya.Vector3();
        Laya.Vector3.subtract( a,b,result);
        return result;
    }

    public static MultiplyNumber(a:Laya.Vector3,b:number ):Laya.Vector3
    {
        let result:Laya.Vector3=new Laya.Vector3();
        Laya.Vector3.scale(a,b,result);
        return result;
    }


    public static Add(a:Laya.Vector3,b:Laya.Vector3 ):Laya.Vector3
    {
        let result:Laya.Vector3=new Laya.Vector3();
        Laya.Vector3.add( a,b,result);
        return result;
    }


    public static Normalize(input:Laya.Vector3)
    {
        let result:Laya.Vector3=new Laya.Vector3();
        Laya.Vector3.normalize(input,result);
        return result;
    }


    public static NegateVector3(vector3:Laya.Vector3)
    {
       let negateV3=new Laya.Vector3();
       negateV3.x=-vector3.x;
       negateV3.y=-vector3.y;
       negateV3.z=-vector3.z;
       return  negateV3;
    }

    public static DistanceXZ(pos1:Laya.Vector3,pos2:Laya.Vector3):number
    {
        let x1=pos1.x;
        let x2=pos2.x;

        let z1=pos1.z;
        let z2=pos2.z;

        let xdis=Math.abs(x1-x2)
        let zdis=Math.abs(z1-z2)

       return Math.sqrt(xdis*xdis+zdis*zdis);

    }





}